//
//  ZNTCHeaderView.m
//  WisdomCommunity
//
//  Created by Yahaong on 16/8/8.
//  Copyright © 2016年 zonten. All rights reserved.
//

#import "ZNTCHeaderView.h"
#import "YHMarcros.h"

@implementation ZNTCHeaderView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setupUI];
    }
    return self;
}

- (void)setupUI
{
    
    UIView *bottomView = [[UIView alloc]init];
    bottomView.backgroundColor = RGBColor(163, 163, 163);
    [self addSubview:bottomView];
    [bottomView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.trailing.bottom.equalTo(self);
        make.height.equalTo(45);
    }];
    UILabel *label = [[UILabel alloc]init];
    label.text = @"已搜索到车位89个";
    label.textColor  = [UIColor whiteColor];
    label.font = [UIFont systemFontOfSize:15];
    [bottomView addSubview:label];
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(bottomView);
        make.leading.equalTo(8);
    }];
    UIButton  *button1 = [[UIButton alloc]init];
    [button1 setImage:[UIImage imageNamed:@"park_icon_occupied"] forState:UIControlStateNormal];
    [button1 setTitle:@"已占车位56" forState:UIControlStateNormal];
    [bottomView addSubview:button1];
    button1.titleEdgeInsets = UIEdgeInsetsMake(0, 10, 0, -10);
    [button1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(bottomView);
        make.leading.equalTo(label.trailing).offset(8);
    }];
    
    UIButton  *button2 = [[UIButton alloc]init];
    [button2 setImage:[UIImage imageNamed:@"park_icon_idle"] forState:UIControlStateNormal];
    [button2 setTitle:@"可用23位" forState:UIControlStateNormal];
    
    [bottomView addSubview:button2];
    [button2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(bottomView);
        make.leading.equalTo(button1.trailing).offset(18);
    }];
    button2.titleEdgeInsets = UIEdgeInsetsMake(0, 10, 0, -10);
    UIImageView *imageView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"park_icon_top"]];
    [self addSubview:imageView];
    
    [imageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.leading.trailing.equalTo(self);
        make.bottom.equalTo(bottomView.top);
        
    }];
}

@end
